﻿using System;
using System.Collections.Generic;
using System.Web;
using Newtonsoft.Json;

namespace Ecreate.Web
{
    public class JsonSearch
    {
        private string _field = "";

        public string Field
        {
            get { return _field; }
            set { _field = value; }
        }

        private string _operate = "";

        public string Operate
        {
            get { return _operate; }
            set { _operate = value; }
        }

        private string _value = "";

        public string Value
        {
            get { return _value; }
            set { _value = value; }
        }

        private string _controlid = "";

        public string Controlid
        {
            get { return _controlid; }
            set { _controlid = value; }
        }
        private string _fieldType = "";

        public string FieldType
        {
            get { return _fieldType; }
            set { _fieldType = value; }
        }

        public static List<JsonSearch> getList(string value)
        {

            List<JsonSearch> l = new List<JsonSearch>();
            Newtonsoft.Json.Linq.JArray array = (Newtonsoft.Json.Linq.JArray)JsonConvert.DeserializeObject(value);
            for (int i = 0; i < array.Count; i++)
            {
                Object o = array[i];
                string v = o.ToString();
                Ecreate.Web.JsonSearch jsearch = Newtonsoft.Json.JsonConvert.DeserializeObject<Ecreate.Web.JsonSearch>(v);
                l.Add(jsearch);
            }
            return l;
        }
    }



    
}
